var t = require("../../../../../../common/vendor.js"), e = {
    data: function() {
        return {
            systemInfo: null,
            cssSafeAreaInsetBottom: -1,
            isReadyDestroy: !1
        };
    },
    computed: {
        windowTop: function() {
            return this.systemInfo && this.systemInfo.windowTop || 0;
        },
        safeAreaBottom: function() {
            if (!this.systemInfo) return 0;
            return Math.max(this.cssSafeAreaInsetBottom, 0);
        },
        isOldWebView: function() {
            try {
                var e = t.index.getSystemInfoSync().system.split(" "), n = e[0], o = parseInt(e[1]);
                if ("iOS" === n && o <= 10 || "Android" === n && o <= 6) return !0;
            } catch (t) {
                t = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(t);
                return !1;
            }
            return !1;
        },
        zSlots: function() {
            return this.$slots;
        }
    },
    beforeDestroy: function() {
        this.isReadyDestroy = !0;
    },
    methods: {
        updateFixedLayout: function() {
            var e = this;
            this.fixed && this.$nextTick(function() {
                e.systemInfo = t.index.getSystemInfoSync();
            });
        },
        _getNodeClientRect: function(e) {
            var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], o = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
            if (this.isReadyDestroy) return Promise.resolve(!1);
            var i = n ? t.index.createSelectorQuery().in(!0 === n ? this : n) : t.index.createSelectorQuery();
            return o ? i.select(e).scrollOffset() : i.select(e).boundingClientRect(), new Promise(function(t, e) {
                i.exec(function(e) {
                    t(!(!e || "" == e || null == e || !e.length) && e);
                });
            });
        },
        _updateLeftAndRightWidth: function(t, e) {
            var n = this;
            this.$nextTick(function() {
                setTimeout(function() {
                    [ "left", "right" ].map(function(o) {
                        n._getNodeClientRect(".".concat(e, "-").concat(o)).then(function(e) {
                            n.$set(t, o, e ? e[0].width + "px" : "0px");
                        });
                    });
                }, 0);
            });
        },
        _getCssSafeAreaInsetBottom: function(t) {
            var e = this;
            this._getNodeClientRect(".zp-safe-area-inset-bottom").then(function(n) {
                e.cssSafeAreaInsetBottom = n ? n[0].height : -1, n && t && t();
            });
        }
    }
};

exports.commonLayoutModule = e;